import ResMgr from "./Managers/ResMgr";
import GameApp from "./Game/GameApp";
import EventMgr from "./Managers/EventMgr";
import SoundMgr from "./Managers/SoundMgr";
import SceneManager from "./Managers/SceneManager";
import PanelManager from "./Managers/PanelManager";
import NetManager from "./Managers/NetManager";


const {ccclass, property} = cc._decorator;

@ccclass
export default class GameLanch extends cc.Component {

    public static Instance: GameLanch = null;

    @property(cc.TextAsset)
    private pbTexAsset: cc.TextAsset = null;
    
    onLoad(): void {
        if(GameLanch.Instance === null) {
            GameLanch.Instance = this;
        }
        else {
            this.destroy();
            return;
        }

        // 初始化框架
        this.node.addComponent(ResMgr);
        this.node.addComponent(EventMgr);
        this.node.addComponent(SoundMgr);
        this.node.addComponent(SceneManager);
        this.node.addComponent(PanelManager);
        this.node.addComponent(NetManager);

        // SceneManger.getInstace().change_scene("s");
        // end
        // 初始化游戏
        this.node.addComponent(GameApp);
        // end
    }

    start(): void {
        GameApp.Instance.GameStart();
    }
}
